import Vue from 'vue'
import ElementUI from 'element-ui';
import HappyScroll from 'vue-happy-scroll'
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router' 
import store from './store'

import i18n from './lang' // Internationalization
import '@/assets/iconfont/iconfont.css'
import '@/styles/index.scss' // global css
import 'vue-happy-scroll/docs/happy-scroll.css'
import './icons' // icon
import './permission'
import './errorLog' // error log

// if (process.env.NODE_ENV === 'development'&&'production') {
//   require('./mock') // simulation data
// } 
import BpmnModeler from '../packages/index'
Vue.use(BpmnModeler)

import FormMaking2 from './index'
Vue.use(FormMaking2)
import uploader from 'vue-simple-uploader'
Vue.use(uploader)
import XrAvatar from '@/components/XrAvatar'
Vue.component('xr-avatar', XrAvatar)
import {
  Flexbox,
  FlexboxItem
} from '@/components/Flexbox'
Vue.component('flexbox', Flexbox)
Vue.component('flexbox-item', FlexboxItem)

import elClickoutside from './directives/elClickoutside'
Vue.directive('elclickoutside', elClickoutside)

import Pagination from "@/components/Pagination";
Vue.component('Pagination', Pagination)

import {addDateRange, parseTime, resetForm} from "@/utils/pangu";
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange

import jsoneditor from 'jsoneditor'
Vue.prototype.$jsoneditor = jsoneditor

// 代码高亮插件
import hljs from 'highlight.js'
Vue.use(hljs.vuePlugin);
import 'highlight.js/styles/github-gist.css'
// 自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"
Vue.component('RightToolbar', RightToolbar)
//表单相关的
import FormMaking from './views/form/index'
Vue.use(FormMaking)
import iconPicker from 'vue-fontawesome-elementui-icon-picker';
Vue.use(iconPicker);
import VueCodemirror from 'vue-codemirror'
Vue.use(VueCodemirror)
import 'codemirror/lib/codemirror.css'
import '../static/ueditor/ueditor.config.js'
import '../static/ueditor/ueditor.all.min.js'
import '../static/ueditor/lang/zh-cn/zh-cn.js'
import '../static/ueditor/themes/default/css/ueditor.css'

Vue.prototype.msgSuccess = function (msg) {
  this.$message({showClose: true, message: msg, type: "success"});
}
Vue.prototype.msgError = function (msg) {
  this.$message({showClose: true, message: msg, type: "error"});
}

Vue.prototype.msgNotifySuccess = function (msg) {
  this.$notify({
    title: '操作成功',
    message: msg,
    duration:1500,
    type: 'success'
  });
}
Vue.prototype.msgNotifyError = function (msg) {
  this.$notify.error({
    title: '错误',
    message: msg,
    duration:1500,
    type: 'error'
  });
}
Vue.prototype.msgInfo = function (msg) {
  this.$message.info(msg);
}

import vueEsign from 'vue-esign'
Vue.use(vueEsign)

import nodeWrap from '@/components/nodeWrap'
Vue.use(nodeWrap)
Vue.component('nodeWrap', nodeWrap); //初始化组件
import addNode from '@/components/addNode'
Vue.use(addNode)
Vue.component('addNode', addNode); //初始化组件

Vue.directive('focus', {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function(el) {
    el.focus()
  }
});

import * as filters from './filters' // global filters

Vue.config.productionTip = false

Vue.use(ElementUI,{
  i18n: (key, value) => i18n.t(key, value)
});
Vue.use(HappyScroll);
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')